Add hier config nested compliance rule feature#979
Add hier config nested compliance rule feature#979Dav-C wants to merge 6 commits intonautobot:developfrom
Conversation
| @@ -0,0 +1,298 @@ | |||
| # Hierarchical Configuration Compliance | |||
There was a problem hiding this comment.
We should come up with a word that will resonate with the network engineer vs the technical implementation, such as partial match or filter configs.
There was a problem hiding this comment.
I've renamed it to Filtered Configuration Compliance. If that doesn't fit, let me know and I'll change it.
There was a problem hiding this comment.
If filtered doesn’t work for you, then how about “Advanced configuration compliance”
There was a problem hiding this comment.
My vote is Limited Configuration Compliance
| from nornir.core.plugins.inventory import InventoryPluginRegister | ||
| from nornir.core.task import Result, Task | ||
| from nornir_nautobot.exceptions import NornirNautobotException | ||
| from pydantic import TypeAdapter |
There was a problem hiding this comment.
This is not a direct dependency in GC, we should consider if we want to make it one or not.
|
|
||
| Filtered configuration compliance requires: | ||
|
|
||
| 1. **CLI Configuration Type**: Only `CLI` configuration types are supported for hierarchical compliance |
There was a problem hiding this comment.
Can we link to appropriate docs/repo here?
| ### Repository Settings | ||
|
|
||
| The same repository settings required for standard compliance apply: | ||
|
|
||
| - Backup repository for storing device configurations | ||
| - Intended configuration repository | ||
| - Proper `backup_path_template` and `intended_path_template` configuration |
There was a problem hiding this comment.
I think we can remove.
| ## Fallback Behavior for Empty Intended Configuration | ||
|
|
||
| In some cases, the intended configuration may not contain any elements that match the compliance rules, resulting in an empty intended configuration text. To handle this scenario, the system includes a fallback mechanism: | ||
|
|
||
| **Interface Fallback**: When the intended configuration text is empty, the system automatically looks for top-level interface configurations in the running configuration and uses them as the intended configuration baseline. | ||
|
|
||
| This fallback behavior: | ||
|
|
||
| 1. **Triggers** when `intended_text` is empty after tag-based filtering | ||
| 3. **Filters** for lines that start with "interface" | ||
| 4. **Uses** these interface declarations as the intended configuration for comparison | ||
|
|
||
| **Example Scenario**: | ||
| - Your hierarchical rule targets specific VLAN configurations | ||
| - The intended configuration template doesn't include those VLANs | ||
| - The running configuration has interface declarations | ||
| - The system uses the interface lines from running config as the baseline | ||
|
|
||
| This ensures that remediation will not remove interfaces when intended configuration is empty for an interface. | ||
|
|
There was a problem hiding this comment.
Let's talk about this before pursuing further. My initial thought is this complicates things too much and going to be hard to meet everyone's POLA.
|
Think my biggest concern is the actual and intended views are
|
|
I think filtered is the whole point TBH. Compliance rules as they stand today are currently filtered if you think about it from a certain point of view - you’re matching on the parent command rather than displaying the whole intended in one screen. For example my intended config can have loads of lines which don’t have a compliance rule set and the app is happy with all the rules green. |
I understand your viewpoint; however, it shifts many other users use cases. Many people use the other config plan types for example (intended) which pulls from the compliance result. This now means its a filtered intended config-set which isn't what most users want. I think the key components are to make this work alongside all the apps features/functionalities. Where the intended and actual are still showing "everything" that matches the root/main parent, and then the missing/extra/compliance result filtered down. |
Current PR DoesActual: Intended: Compliance: Follows Existing patternActual: Intended: Compliance: |
|
@Dav-C I think internally we're thinking of showing both would be good. So either like this screenshot, or potentialy a toggle options between |
|
I had the opportunity to review this new feature and wanted to share some thoughts from an outside perspective:
|

Closes: #978
What's Changed
To Do